await

abstract fun await(predicate: Predicate<MediaReceiver>): MediaReceiver

Blocks the current thread until the first receiver matching the predicate is discovered.

If a matching receiver has already been discovered, returns it immediately.

Example of usage:


browser.set(StartPresentationCallback.class, (params, tell) -> {
    params.mediaReceivers().refresh();
    MediaReceiver receiver = params.mediaReceivers().await(mediaReceiver -> {
        return mediaReceiver.name().startsWith("Samsung TV");
    });
    tell.start(receiver);
});

Return

the first discovered receiver matching the predicate

Throws

when the profile is deleted or its engine is closed

when the receiver has not been discovered within 45 seconds


abstract fun await(predicate: Predicate<MediaReceiver>, timeout: Duration): MediaReceiver

Blocks the current thread until the first receiver matching the predicate is discovered.

If a matching receiver has already been discovered, returns it immediately.

Return

the first discovered receiver matching the predicate

Throws

when the profile is deleted or its engine is closed

when the receiver has not been discovered within timeout